package oop.core.med;

import java.util.ArrayList;
import java.util.List;

import oop.core.Scheduler;

/**
 * Class in charge of (un)pausing all subsystems
 * @author DangMH
 *
 */
public class PauseMediator {
	private List<Pausable> pauseList;
	
	/**
	 * Empty constructor.
	 */
	public PauseMediator()
	{
		pauseList = new ArrayList<Pausable>();
	}
	
	/**
	 * Parameterized constructor.
	 * @param scheduler
	 * @param avatarMovementMediator
	 * @param inventoryManagementMediator
	 * @param skillMediatorFromHotkey
	 */
	public PauseMediator( Pausable scheduler, Pausable avatarMovementMediator, Pausable inventoryManagementMediator, Pausable skillMediatorFromHotkey )
	{
		pauseList = new ArrayList<Pausable>();
		pauseList.add( scheduler );
		pauseList.add( avatarMovementMediator );
		pauseList.add( inventoryManagementMediator );
		pauseList.add( skillMediatorFromHotkey );
	}
	
	/**
	 * operation for handling setting the pauseFlag
	 */
	public void pause()
	{
		for( Pausable p : pauseList )
		{
			p.pause();
		}
	}
	
	/**
	 * operation for handling clearing the pauseFlag
	 */
	public void unpause()
	{
		for( Pausable p : pauseList )
		{
			p.unpause();
		}
	}
	
	/**
	 * operation for handling toggling the pauseFlag
	 */
	public void toggle()
	{
		for( Pausable p : pauseList )
		{
			p.toggle();
		}
	}
}
